package js.dwim.client;

import java.util.Scanner;

import js.dwim.client.domain.GameWorld;

public class ParserUtils
{
    public static GameWorld parseWorld( String data ) throws ParserException
    {
        String arr[]    = data.split( "\n" );
        int index       = 0;
        
        if ( !arr[index].trim().equals( "OK" ) )
        {
            throw new ParserException( "Server returned error code" );
        }
        Scanner scan    = new Scanner( arr[++index] );
        int totalNodes  = scan.nextInt();
        for ( int i = 0; i < totalNodes; i++ )
        {
            index++; // skip key
            scan = new Scanner( arr[++index] ); 
            
        }
        GameWorld world = null;
        return world;
    }
}
